package io.renren.modules.waybillorder.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.waybillorder.dao.WaybillOrderDao;
import io.renren.modules.waybillorder.entity.WaybillOrderEntity;
import io.renren.modules.waybillorder.service.WaybillOrderService;


@Service("waybillOrderService")
public class WaybillOrderServiceImpl extends ServiceImpl<WaybillOrderDao, WaybillOrderEntity> implements WaybillOrderService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<WaybillOrderEntity> waybillOrderEntityQueryWrapper = new QueryWrapper<>();
        if (StringUtils.isNotBlank((String)params.get("waybillno"))){
            waybillOrderEntityQueryWrapper.lambda().eq(WaybillOrderEntity::getWaybillno,params.get("waybillno"));
        }
        IPage<WaybillOrderEntity> page = this.page(
                new Query<WaybillOrderEntity>().getPage(params),waybillOrderEntityQueryWrapper);
        return new PageUtils(page);
    }

}